using System.ComponentModel;

namespace Close.io.API
{
	public class TaskQueryBuilder : QueryBuilderBase
	{
		public TaskQueryBuilder(string leadId) : base(leadId)
		{
		}

		public TaskQueryBuilder SetAssignedTo(string assignedTo)
		{
			Add("assigned_to", assignedTo);
			return this;
		}


		public TaskQueryBuilder SetDueDateExpression(IDateExpression dateExpression)
		{
			Add(dateExpression.GetKey(), dateExpression.GetValue());
			return this;
		}

		public TaskQueryBuilder ReturnCompleted()
		{
			Add("is_complete", "true");
			return this;
		}

		public TaskQueryBuilder SetOrderBy(TaskSortField orderBy)
		{
			if (orderBy != TaskSortField.None)
				Add("order_by", orderBy.GetAttributeOfType<DescriptionAttribute>().Description);
			return this;
		}
	}
}